<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>uri.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
       <span class="fn">uri.js</span>
</div>

<div class="g-section g-tpl-75-25">
  <div class="g-unit g-first" id="description">
    <span class='nodesc'>No description.</span>
  </div>
  

        <div class="g-unit" id="useful-links">
          <div class="title">Useful links</div>
          <ol>
            <li><a href="local_closure_goog_uri_uri.js.source.html"><span class='source-code-link'>Source Code</span></a></li>
            <li><a href="http://code.google.com/p/closure-library/source/browse/local/closure/goog/uri/uri.js">Git</a></li>
          </ol>
        </div>
</div>

<h2 class="g-first">File Location</h2>
  <div class="g-section g-tpl-20-80">
    <div class="g-unit g-first">
      <div class="g-c-cell code-label">/goog/uri/uri.js</div>
    </div>
  </div>
<hr/>


  <h2>Classes</h2>
 <div class="fn-constructor">
        <a href="class_goog_Uri.html">
          goog.Uri</a><br/>
        <div class="class-details">This class contains setters and getters for the parts of the URI.
The <code>getXyz</code>/<code>setXyz</code> methods return the decoded part
-- so<code>goog.Uri.parse('/foo%20bar').getPath()</code> will return the
decoded path, <code>/foo bar</code>.

The constructor accepts an optional unparsed, raw URI string.  The parser
is relaxed, so special characters that aren't escaped but don't cause
ambiguities will not cause parse failures.

All setters return <code>this</code> and so may be chained, a la
<code>goog.Uri.parse('/foo').setFragment('part').toString()</code>.

</div>
 </div>
 <div class="fn-constructor">
        <a href="class_goog_Uri_QueryData.html">
          goog.Uri.QueryData</a><br/>
        <div class="class-details">Class used to represent URI query parameters.  It is essentially a hash of
name-value pairs, though a name can be present more than once.

Has the same interface as the collections in goog.structs.

</div>
 </div>
      
<br/>

  <div class="legend">
        <span class="key publickey"></span><span>Public</span>
        <span class="key protectedkey"></span><span>Protected</span>
        <span class="key privatekey"></span><span>Private</span>
  </div>









<div class="section">
  <table class="horiz-rule">


  </table>
</div>




  <h2>Global Functions</h2>





<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.Uri.create"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.Uri.</span><span class="entryName">create<span class="args">(<span class="arg">opt_scheme</span>,&nbsp;<span class="arg">opt_userInfo</span>,&nbsp;<span class="arg">opt_domain</span>,&nbsp;<span class="arg">opt_port</span>,&nbsp;<span class="arg">opt_path</span>,&nbsp;<span class="arg">opt_query</span>,&nbsp;<span class="arg">opt_fragment</span>,&nbsp;<span class="arg">opt_ignoreCase</span>)</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="class_goog_Uri.html">goog.Uri</a></span>
      </div>


     <div class="entryOverview">
       Creates a new goog.Uri object from unencoded parts.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">opt_scheme</span>
        : <span>?</span><span class="type">string=</span>
        <div class="entryOverview">Scheme/protocol or full URI to parse.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_userInfo</span>
        : <span>?</span><span class="type">string=</span>
        <div class="entryOverview">username:password.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">opt_domain</span>
        : <span>?</span><span class="type">string=</span>
        <div class="entryOverview"><a href="http://www.google.com">www.google.com</a>.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_port</span>
        : <span>?</span><span class="type">number=</span>
        <div class="entryOverview">9830.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">opt_path</span>
        : <span>?</span><span class="type">string=</span>
        <div class="entryOverview">/some/path/to/a/file.html.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_query</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span><span>&nbsp;|&nbsp;</span><span class="type">goog.Uri.QueryData=</span>
        <div class="entryOverview">a=1&amp;b=2.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">opt_fragment</span>
        : <span>?</span><span class="type">string=</span>
        <div class="entryOverview">The fragment without the #.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_ignoreCase</span>
        : <span class="type">boolean=</span>
        <div class="entryOverview">Whether to ignore parameter name case in
    #getParameterValue.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="class_goog_Uri.html">goog.Uri</a></span>&nbsp;
            The new URI object.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_uri_uri.js.source.html#line822">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.Uri.QueryData.createFromKeysValues"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.Uri.QueryData.</span><span class="entryName">createFromKeysValues<span class="args">(<span class="arg">keys</span>,&nbsp;<span class="arg">values</span>,&nbsp;<span class="arg">opt_uri</span>,&nbsp;<span class="arg">opt_ignoreCase</span>)</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="class_goog_Uri_QueryData.html">goog.Uri.QueryData</a></span>
      </div>


     <div class="entryOverview">
       Creates a new query data instance from parallel arrays of parameter names
and values. Allows for duplicate parameter names. Throws an error if the
lengths of the arrays differ.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">keys</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&gt;
        <div class="entryOverview">Parameter names.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">values</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>
        <div class="entryOverview">Parameter values.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">opt_uri</span>
        : <span class="type">goog.Uri=</span>
        <div class="entryOverview">URI object that should have its cache
    invalidated when this object updates.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_ignoreCase</span>
        : <span class="type">boolean=</span>
        <div class="entryOverview">If true, ignore the case of the parameter
    name in #get.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="class_goog_Uri_QueryData.html">goog.Uri.QueryData</a></span>&nbsp;
            The populated query data instance.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_uri_uri.js.source.html#line1121">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.Uri.QueryData.createFromMap"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.Uri.QueryData.</span><span class="entryName">createFromMap<span class="args">(<span class="arg">map</span>,&nbsp;<span class="arg">opt_uri</span>,&nbsp;<span class="arg">opt_ignoreCase</span>)</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="class_goog_Uri_QueryData.html">goog.Uri.QueryData</a></span>
      </div>


     <div class="entryOverview">
       Creates a new query data instance from a map of names and values.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">map</span>
        : <span>!</span><span class="type"><a href="class_goog_structs_Map.html">goog.structs.Map</a></span><span>&nbsp;|&nbsp;</span><span>!</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>
        <div class="entryOverview">Map of string parameter
    names to parameter value. If parameter value is an array, it is
    treated as if the key maps to each individual value in the
    array.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_uri</span>
        : <span class="type">goog.Uri=</span>
        <div class="entryOverview">URI object that should have its cache
    invalidated when this object updates.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">opt_ignoreCase</span>
        : <span class="type">boolean=</span>
        <div class="entryOverview">If true, ignore the case of the parameter
    name in #get.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="class_goog_Uri_QueryData.html">goog.Uri.QueryData</a></span>&nbsp;
            The populated query data instance.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_uri_uri.js.source.html#line1087">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.Uri.decodeOrEmpty_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.Uri.</span><span class="entryName">decodeOrEmpty_<span class="args">(<span class="arg">val</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Decodes a value or returns the empty string if it isn't defined or empty.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">val</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span><span>&nbsp;|&nbsp;</span><span class="type">undefined</span>
        <div class="entryOverview">Value to decode.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            Decoded value.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_uri_uri.js.source.html#line914">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.Uri.encodeChar_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.Uri.</span><span class="entryName">encodeChar_<span class="args">(<span class="arg">ch</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Converts a character in [\01-\177] to its unicode character equivalent.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">ch</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">One character string.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            Encoded string.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_uri_uri.js.source.html#line944">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.Uri.encodeSpecialChars_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.Uri.</span><span class="entryName">encodeSpecialChars_<span class="args">(<span class="arg">unescapedPart</span>,&nbsp;<span class="arg">extra</span>)</span>
        </span>
        &#8658; <span>?</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       If unescapedPart is non null, then escapes any characters in it that aren't
valid characters in a url and also escapes any special characters that
appear in extra.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">unescapedPart</span>
        : <span class="type">*</span>
        <div class="entryOverview">The string to encode.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">extra</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp">RegExp</a></span>
        <div class="entryOverview">A character set of characters in [\01-\177].</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>?</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            null iff unescapedPart == null.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_uri_uri.js.source.html#line930">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.Uri.haveSameDomain"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.Uri.</span><span class="entryName">haveSameDomain<span class="args">(<span class="arg">uri1String</span>,&nbsp;<span class="arg">uri2String</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>
      </div>


     <div class="entryOverview">
       Checks whether two URIs have the same domain.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">uri1String</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">First URI string.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">uri2String</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">Second URI string.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>&nbsp;
            true if the two URIs have the same domain; false otherwise.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_uri_uri.js.source.html#line997">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.Uri.parse"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.Uri.</span><span class="entryName">parse<span class="args">(<span class="arg">uri</span>,&nbsp;<span class="arg">opt_ignoreCase</span>)</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="class_goog_Uri.html">goog.Uri</a></span>
      </div>


     <div class="entryOverview">
       Creates a uri from the string form.  Basically an alias of new goog.Uri().
If a Uri object is passed to parse then it will return a clone of the object.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">uri</span>
        : <span class="type">*</span>
        <div class="entryOverview">Raw URI string or instance of Uri
    object.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_ignoreCase</span>
        : <span class="type">boolean=</span>
        <div class="entryOverview">Whether to ignore the case of parameter
names in #getParameterValue.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="class_goog_Uri.html">goog.Uri</a></span>&nbsp;
            The new URI object.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_uri_uri.js.source.html#line801">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.Uri.removeDotSegments"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.Uri.</span><span class="entryName">removeDotSegments<span class="args">(<span class="arg">path</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Removes dot segments in given path component, as described in
RFC 3986, section 5.2.4.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">path</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">A non-empty path component.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            Path component with removed dot segments.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_uri_uri.js.source.html#line868">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.Uri.resolve"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.Uri.</span><span class="entryName">resolve<span class="args">(<span class="arg">base</span>,&nbsp;<span class="arg">rel</span>)</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="class_goog_Uri.html">goog.Uri</a></span>
      </div>


     <div class="entryOverview">
       Resolves a relative Uri against a base Uri, accepting both strings and
Uri objects.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">base</span>
        : <span class="type">*</span>
        <div class="entryOverview">Base Uri.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">rel</span>
        : <span class="type">*</span>
        <div class="entryOverview">Relative Uri.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="class_goog_Uri.html">goog.Uri</a></span>&nbsp;
            Resolved uri.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_uri_uri.js.source.html#line848">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>






      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Directory uri</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">File Reference</h2>
            <div id="sideFileIndex" rootPath="" current="/goog/uri/uri.js"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
